home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Demos / A.D. Software / OOFILE / Buildable, limited OOFILE / samples / ooftst01.inc < prev    next >
Text File  |  1996-02-18  |  2KB  |  67 lines

  1. // included in ooftest1, 13, 14, 15 and 18
  2.  
  3. DECLARE_CLASS(dbPeople)
  4.     dbChar        LastName, OtherNames;
  5.     dbLong        Salary;
  6.     dbText        Description;
  7.     dbDate        LastPaid;
  8.  
  9. #ifndef demoNoIndexes
  10.     dbPeople() :
  11.                 dbTable("People"),
  12.                 LastName(39, "Last Name", kIndexCompress),
  13.                 OtherNames(79, "Other Names", kIndexCompress),
  14.                 Salary("Salary", kIndexed),
  15.                 Description("Description"),
  16.                 LastPaid("Last Paid", kIndexed)
  17.                 {};
  18. #else
  19.     dbPeople() :
  20.                 dbTable("People"),
  21.                 LastName(39, "Last Name"),
  22.                 OtherNames(79, "Other Names"),
  23.                 Salary("Salary"),
  24.                 Description("Description"),
  25.                 LastPaid("Last Paid", kIndexed)
  26.                 {};
  27. #endif
  28.     
  29. // my own data entry procedures
  30.     void Add(const char *lname, const char *oname, const long salary);
  31.     void AddTestData();
  32. };
  33.  
  34. void dbPeople::Add(const char *lname, const char *oname, const long salary)
  35. {
  36.     newRecord();
  37.     LastName = lname;
  38.     OtherNames = oname;
  39.     Salary = salary;
  40.     LastPaid.setDateToCurrentDate();
  41.     saveRecord();
  42. }
  43.  
  44.  
  45. void dbPeople::AddTestData()
  46. {
  47.     Add("Smith", "John", 0);  // specifically to test zero searches
  48.     Description = "John is a plain sort of bloke, not the kind to stand-out in a crowd\n";
  49.     Description += "and in fact you'd probably say he's the classic Mr Average. However ";
  50.     Description += "he harbours secret dreams of being a brain surgeon and a bloke 'wot ";
  51.     Description += "goes down the sewers in big rubber boots'\n";
  52.     LastPaid -= 21;  // 3 weeks ago
  53.     saveRecord();
  54.  
  55.     Add("Dent", "Trissa", 5000);
  56.     Description = "Trissa is married to Andy and mother of Tanith and Ryan";
  57.     saveRecord();
  58.  
  59.     Add("Dent", "Andy", 25000);
  60.     Description = "Andy has a Don Quixote complex but is trying to strengthen his Sancho ";
  61.     Description += "Panza side to stop him before he gets into trouble,\n rather than taking ";
  62.     Description += "Herculean efforts to get him out of the overcommitted messes he creates.\n";
  63.     LastPaid -= 7;  // 1 week ago
  64.     saveRecord();
  65.  
  66.     Add("Taylor", "Ken", 75000);
  67. }